<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/detail/default.css" />
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/detail/component.css" />
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/amazeui.min.css"/>
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/hy.admin.css"/>
		<script src="{$_C.hy_path}js/detail/modernizr.custom.js"></script>
	</head>
	<body>
		<div class="am-g">
			 {include file='../Common/hy_header.html'}
		<form id="formsearch" >
			<div class="am-u-md-6 am-cf">
				
				<div  style="padding:10px;">
		          <div class="am-input-group am-input-group-sm">
		          		<span class="am-input-group-label" style="background-color: #fff;border: 0px;">时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
		          		<input value="{$total.startTime}"  style="width:230px;" type="text" id="startTime" name="startTime" class="field am-form-field hy-js-search">
						<span class="am-input-group-label" style="background-color: #fff;border: 0px;">至&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
		          		<input value="{$total.endTime}" style="width:230px;" type="text" id="endTime" name="endTime" class="field am-form-field hy-js-search">
		          </div>
		        </div>
		          <div  style="padding:10px;">
		          <div class="am-input-group am-input-group-sm">
		          		<span class="am-input-group-label" style="background-color: #fff;border: 0px;">商户订单号</span>
		          		<input value="{$total.out_trade_no}"  style="width:230px;" type="text" id="out_trade_no" name="out_trade_no" class="field am-form-field hy-js-search">
						<span class="am-input-group-label" style="background-color: #fff;border: 0px;">微信支付单号</span>
		          		<input value="{$total.transaction_id}"  style="width:230px;" type="text" id="transaction_id" name="transaction_id" class="field am-form-field hy-js-search">
		          </div>
		        </div>		
				<div style="padding:10px;">
		          <div class="am-input-group am-input-group-sm">
		          		<span class="am-input-group-label" style="background-color: #fff;border: 0px;">用户名&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
		          		<input value="{$total.nickname}"  style="width:230px;" type="text" id="nickname" name="nickname" class="field am-form-field hy-js-search">
						
						<span class="am-input-group-label" style="background-color: #fff;border: 0px;">类型&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
						<select name="status" id="status" style="width:230px;" class=" field am-form-field">
			               
			               <option value="0">--- ---</option>
			               
			               <option {if $total.status eq 1}selected="selected" {/if} value="1">支付成功</option>
						   
			               <option {if $total.status eq 2}selected="selected" {/if} value="2">未付款</option>
			               
			               <option {if $total.status eq 3}selected="selected" {/if} value="3">订单失效</option>
			                 
			            </select>
						
						
		          </div>
		        </div>
		        
		        <div style="padding:10px;">
		          <div class="am-input-group am-input-group-sm">
		          		
						<span class="am-input-group-label" style="background-color: #fff;border: 0px;">渠道&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
						<select name="pay_place" id="pay_place" style="width:230px;" class=" field am-form-field">
			               
			               <option value="0">--- ---</option>
			               
			               <option {if $total.pay_place eq 4}selected="selected" {/if} value="4">邀请码</option>
						   
			               <option {if $total.pay_place eq 2}selected="selected" {/if} value="2">摇地铁</option>
			               
			               <option {if $total.pay_place eq 3}selected="selected" {/if} value="3">摇公交</option>
			               
			               <option {if $total.pay_place eq 1}selected="selected" {/if} value="1">默认渠道</option>
			                 
			               <option {if $total.pay_place eq 5}selected="selected" {/if} value="5">渠道5</option>
						   
			               <option {if $total.pay_place eq 6}selected="selected" {/if} value="6">渠道6</option>
			               
			               <option {if $total.pay_place eq 7}selected="selected" {/if} value="7">渠道7</option>
			                 
			            </select>
						
						<span class="am-input-group-btn" style=" height: 45px;padding-left: 50px;">
		                  <button class="am-btn am-btn-default bin-select-searchbtn" type="button">搜索</button>
		                </span>
		          </div>
		        </div>
		        
				
		        </div>
				
				
				
	      </div>
		</form>
	</div>
      <div class="am-g">
      <div class="am-u-sm-12">
        <div class="am-form">
          <table class="am-table am-table-striped am-table-hover table-main">
            <thead>
              <tr>
				<th  class="table-type">
				用户名
				<br>
				姓名
				<br>
				电话
				</th>
				<th class="table-type">交易时间</th>
				<th  class="table-type">
				商户订单号
				<br>
				微信支付单号
				</th>
				<!-- <th  class="table-type">微信支付单号</th> -->
				<th  class="table-type">支付场景</th>
				
				<th  class="table-type">成人券</th>
				<th  class="table-type">慈善券</th>
				<th  class="table-type">儿童券</th>
				<th  class="table-type">交易状态</th>
				<th  class="table-author">交易金额(元)</th>
				<th class="table-author">操作</th>
				
              </tr>
          </thead>
          <tbody>
          	   <!--{foreach key=key from=$sql_list item=sql}-->
            <tr>
              <td style="max-width:100px;">
              {$sql.nickname}
              <br>
              {$sql.name|default:"-"}
              <br>
              {$sql.phone|default:"-"}
              <br>
              
              </td>
              <td >{$sql.time_start}</td>
              <td >{$sql.out_trade_no|default:" - "}
              <br>{$sql.transaction_id|default:" - "}
              </td>
			  <!-- <td >{$sql.transaction_id|default:" - "}</td> -->
			  <td>
			  {if $sql.pay_place ==2}
			  	摇地铁
			  {elseif $sql.pay_place ==3}
			  	摇公交
			  {elseif $sql.pay_place ==4}
			  	邀请码
			  {elseif $sql.pay_place ==1}
			  	默认渠道
			  	
			  {else}
			  	渠道{$sql.pay_place}
			  {/if}
			  </td>
			   <td >{$sql.card1_total}(已领{$sql.card1_get})</td>
			    <td >{$sql.card2_total}(已领{$sql.card2_get})</td>
			     <td >{$sql.card3_total}(已领{$sql.card3_get})</td>
			  <td>{$sql.pay_status_show|default:" - "}</td>
			  <td >{$sql.total_fee}</td>
     		  <td>
     		  		<div class="am-btn-toolbar">
	                  <div class="am-btn-group am-btn-group-xs">
	                  	{if $sql.pay_status neq 'SUCCESS'}
	                    <button onClick="successPayOrderQuery('{$sql.out_trade_no}')"  class="am-btn am-btn-default am-btn-xs am-text-danger "><span class="am-icon-trash-o"></span> 再次确认</button>
	                    <button data-id="{$sql.id}" data-modal="modal-1"   class="am-btn am-btn-default am-btn-xs am-text-danger md-trigger "><span class="am-icon-trash-o"></span> 手动确认</button>
						{/if}
	                  </div>
	                </div>
     		  </td>
            </tr>
                  <!--{/foreach}-->  
          </tbody>
        </table>
          <div class="am-cf">

  <div class="am-fr">
  {$list_page}
  </div>
</div>
          <hr />
      
        </div>
      </div>

    </div>
    </div>
	<div class="md-modal md-effect-1" id="modal-1">
			<div class="md-content">
				<h3>微信订单号</h3>
				<div>
					<table>
						<tr>
							<td><strong>微信订单号:</strong></td>
							<td><input style='width:280px;' value = "" name="keyword" id="keyword" ></input></td>
						</tr>
					</table>
					<div style="height:10px;"></div>
					<div>
						<input value="" name="id" id="id" type="hidden"></input>
					<button onclick="saveTransaction()" style="float: left;margin-left: 65px;">保存</button>
					<button style="	float: right;margin-right: 47px;" class="md-close">关闭</button>
					</div>
				</div>
			</div>
		</div>
   {include file='../Common/hy_footer.html'}
   
   
   <script type="text/javascript" src="{$_C.hy_path}js/laydate/laydate.js"></script>
   <script type="text/javascript" src="{$_C.hy_path}js/Map.js"></script>
   <script type="text/javascript" src="{$_C.hy_path}js/bin.select.js"></script>
   
   
   <div class="md-overlay"></div>
   
   <script src="{$_C.hy_path}js/detail/classie.js"></script>
	<script src="{$_C.hy_path}js/detail/modalEffects.js"></script>
	<script>
		// this is important for IEs
		var polyfilter_scriptpath = '{$_C.hy_path}js/detail/';
	</script>
	<script src="{$_C.hy_path}js/detail/cssParser.js"></script>
	<script src="{$_C.hy_path}js/detail/css-filters-polyfill.js"></script>
   <script type="text/javascript">
   	$(function(){
			  
		  laydate({
		   elem: '#startTime',
		   istime:true,
		   format: 'YYYY-MM-DD hh:mm:ss',
		});
		  laydate({
		   elem: '#endTime',
		   istime:true,
		   format: 'YYYY-MM-DD hh:mm:ss',
		})	
	})
	$('.bin-select-searchbtn').click(function(){
		var url = window.location.href;
           url = url.substring(0,url.indexOf("?"));
		   url+="?g=admin&m=suipai&a=prince";
		var json = uriJson(bulidFilterParams($("#formsearch")));
		if(json!=""&&json!=null&&json!=undefined){
			window.location.href=url+"&"+json;
		}else{
			window.location.href=url;
		}
	});
	
	function loadPage(where){
		var url = window.location.href;
           url = url.substring(0,url.indexOf("?"));
		   url+="?g=admin&m=suipai&a=prince";
		var json = uriJson(bulidFilterParams($("#formsearch")));
		if(json!=""&&json!=null&&json!=undefined){
			window.location.href=url+"&"+json+where;
		}else{
			window.location.href=url+where;
		}
	}
	
	function successPayOrderQuery(out_trade_no){
			 	 var url = "index.php?g=mobile&m=wxpay&a=orderquery&out_trade_no="+out_trade_no;
				$.get(url,function(res){
					if(res=="SUCCESS"){
						alert("重新确认订单成功");
						$('.bin-select-searchbtn').click();
					}else{
						alert("该单仍然未付款");
					}
				},"text");
			 }
			 
			 
	function saveTransaction(){
		var url="index.php?g=admin&m=suipai&a=saveTransaction";
		var transaction = $("#keyword").val();
		var id = $("#id").val();
		if(transaction==""||transaction==null){
			alert("微信订单号不可为空");
		}
		var data = {
				"id":id,
				"transaction":transaction
			}
		$.post(url,data,function(res){
			if(res.error==0){
				alert("确认订单成功");
				$('.bin-select-searchbtn').click();
			}else{
				alert(res.content);
//				$("#id").val("");
//				$("#transaction").val("");
//				$(".md-close").click();
			}
		},"json");
	}
   </script>
	</body>
</html>
